package com.jstyle.jclife.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;

import com.jstyle.jclife.fragment.EcgShowFragment;
import com.jstyle.jclife.model.HealthData;

import java.util.ArrayList;
import java.util.List;


/**
 * 历史数据适配器
 * @author Administrator
 *
 */
public class MyViewPagerAdapter extends FragmentStatePagerAdapter {
	int size=1;
	List<HealthData>pathList=new ArrayList<>();

	public MyViewPagerAdapter(FragmentManager fm,int size,List<HealthData>pathList
			) {
		super(fm);
		this.size=size;
		this.pathList=pathList;

		// TODO Auto-generated constructor stub
	}

	private static final String TAG = "MyViewPagerAdapter";
	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		String time=null;
		if(pathList.size()!=0){
			time=pathList.get(arg0).getTime();
		}
		return EcgShowFragment.newInstance(time);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return size;
	}
//	public void changeSize(int size, List<String>pathList){
//		this.size=size;
//		this.pathList=pathList;
//		notifyDataSetChanged();
//	}
	@Override
	public int getItemPosition(Object object) {
		// TODO Auto-generated method stub
		return PagerAdapter.POSITION_NONE;
	}
}
